﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 信息记录系统
{
    public partial class Form14 : Form
    {
        public Form14(DataRow dr)
        {
            InitializeComponent();
            datarow = dr;
        }
        DataRow datarow;
        //定义有参的构造函数
        /*public Form14(DataRow row)
        {
            InitializeComponent();

            //获取数据

            datarow = row;
        }*/
        private void Form14_Load(object sender, EventArgs e)
        {
            textBox1.Text = DR2Str(datarow, "number-id");//获取数据到textbox中
            textBox2.Text = DR2Str(datarow, "equipment-name");
            textBox3.Text = DR2Str(datarow, "type");
            textBox4.Text = DR2Str(datarow, "model");
            textBox5.Text = DR2Str(datarow, "auto-times");
            textBox6.Text = DR2Str(datarow, "admin-address");
            textBox7.Text = DR2Str(datarow, "username");
            textBox8.Text = DR2Str(datarow, "password");
            textBox9.Text = DR2Str(datarow, "maintenance");
            textBox10.Text = DR2Str(datarow, "notie");
            textBox11.Text = DR2Str(datarow, "number-serial");
        }
        private string DR2Str(DataRow dr, string cn)
        {
            try
            {
                return dr[cn].ToString();
            }
            catch
            {
                return string.Empty;
            }
        }
    }
}
